package com.xdq.spring.model;

import java.io.Serializable;
import java.util.List;

public class Car implements Serializable {

    private String brand;

    private List<Wheel> wheels;

    private Skeleton skeleton;

    private Transmission transmission;

    private Engine engine;

    private List<Light> lights;

    public Car() {
        System.out.println("Car被实例化了");
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public void fire() {
        engine.fire();
    }

    public void run() {
        transmission.shift();
        System.out.println("汽车跑动起来了");
    }

    public void shift(){
        transmission.shift();
    }

    public void stop() {
        engine.stop();
    }

    public void turnLightOn() {
        for (Light light : lights) {
            light.turnOn();
        }
    }

    public void turnLightOff() {
        for (Light light : lights) {
            light.trunOff();
        }
    }

    public List<Wheel> getWheels() {
        return wheels;
    }

    public void setWheels(List<Wheel> wheels) {
        this.wheels = wheels;
    }

    public Skeleton getSkeleton() {
        return skeleton;
    }

    public void setSkeleton(Skeleton skeleton) {
        this.skeleton = skeleton;
    }

    public Transmission getTransmission() {
        return transmission;
    }

    public void setTransmission(Transmission transmission) {
        this.transmission = transmission;
    }

    public Engine getEngine() {
        return engine;
    }

    public void setEngine(Engine engine) {
        this.engine = engine;
    }

    public List<Light> getLights() {
        return lights;
    }

    public void setLights(List<Light> lights) {
        this.lights = lights;
    }

    @Override
    public String toString() {
        return "Car{" +
                "brand='" + brand + '\'' +
                ", wheels=" + wheels +
                ", skeleton=" + skeleton +
                ", transmission=" + transmission +
                ", engine=" + engine +
                ", lights=" + lights +
                '}';
    }
}
